<template>
  <div class="page">
    <div class="operat">
      <!-- <span>审批状态：</span> -->
      <!-- <zm-data-radio is-btn v-model="checkStatus" k1="checkStatus" @change="loadList" /> -->

      <span class="fr">
        <span class="pr10">退货记录（共<span class="fc-blue">{{ refundCount || 0 }}</span>条）</span>
        <span class="pr10">退货总数量（张）：<span class="fc-blue">{{refundTotalNumber||0}}</span></span>
        <span class="pr10">剩余数量（张）：<span class="fc-blue">{{residueAllNumber||0}}</span></span>
        <span>退货金额：<span class="fc-blue">￥{{refundTotalAmount||0}}</span></span>
      </span>
    </div>
    <zm-table-data
      :data="tableParams.data"
      :columns="columns"
      :fetch="loadList"
      :table-params="tableParams"
    ></zm-table-data>
  </div>
</template>

<script>
import tableMixin from '@/mixins/zmTableMixin'
import { refundColumns } from '../const'
import {getRefundPageList} from '@/api/src/saleOrder'

export default {
  name: 'SaleInfo',
  components: {},
  mixins: [tableMixin],
  props: {
    obj: {
      type: Object,
      default: {}
    }
  },
  data () {
    return {
      checkStatus: '3',
      count: '',
      refundCount: 0,
      refundTotalAmount: 0,
      refundTotalNumber: 0,
      residueAllNumber: 0
    }
  },
  computed: {
    columns () {
      return refundColumns(this)
    }
  },
  created () {},
  methods: {
    async loadList () {
      const res = await getRefundPageList(
        this.assignQuery({ orderId: this.obj.saleId, checkStatus: '3', orderNo: this.obj.orderNo })
      )
      this.count = res.count
      this.refundCount = res.refundCount
      this.refundTotalAmount = res.refundTotalAmount
      this.refundTotalNumber = res.refundTotalNumber
      this.residueAllNumber = res.residueAllNumber
      this.initialTableData(res.list, res.count)
    },
    onDetail (row) {
      console.log()
    }
  }
}
</script>

<style scoped lang="scss">
.operat {
  height: 40px;
  line-height: 40px;
  margin-bottom: 10px;
}
</style>
